package com.example.xueshen.common.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.xueshen.common.dao.CourseDao;
import com.example.xueshen.common.dao.StudentsMapper;
import com.example.xueshen.common.entity.Ban;
import com.example.xueshen.common.entity.Course;
import com.example.xueshen.common.service.CourseService;
import com.example.xueshen.common.service.StudentsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service

public class CourseServiceImpl implements CourseService {
    @Resource
    private CourseDao courseDao;

    @Override
    public List<Course> getAllByPlus() {
        return courseDao.getAllByPlus();
    }

    @Override
    public boolean toAdd(Course course) {
        return courseDao.insert(course) > 0;
    }

    @Override
    public boolean update(Course course) {
        return courseDao.updateById(course) > 0;
    }

    @Override
    public Course getById(Integer cid) {
        return courseDao.selectById(cid);
    }

    @Override
    public boolean deleteById(Integer cid) {
        return courseDao.deleteById(cid)>0;
    }

    @Override
    public Page<Course> selectBy(Page<Course> page) {
        return courseDao.selectPage(page,null);
    }

    @Override
    public Page<Course> selectByLike(String name, Page<Course> page) {
        return courseDao.selectByLike(name,page);
    }

}
